<template>
  <div>
    <div
      v-for="div in divs"
      :key="div.id"
    >
      <div class="row">
        <div class="col-12">Div {{ div.name }}</div>
      </div>
      <button
        class="btn btn-danger"
        @click="deleteRow(div.id)"
      >删除</button>

    </div>
    <!-- 11242142342 -->
    <button
      class="btn btn-danger"
      @click="addRow"
    >添加</button>
  </div>

</template>

<script>
export default {
  name: 'ApprovalsIndex',
  data() {
    return {
      index: 0,
      divs: [{ name: '张三' }]
    }
  },
  methods: {
    addRow() {
      this.divs.push({
        id: this.index,
        name: 'div' + this.index
      })
      this.index++
    },
    deleteRow(index) {
      this.divs.splice(index, 1)
    }
  }

}
</script>

<style lang="scss" scoped>

</style>

